package tiruvury.InterviewPrep.Generic;

import java.util.ArrayList;
import java.util.List;

import tiruvury.InterviewPrep.HelperClasses.MenuItem;
import tiruvury.InterviewPrep.HelperClasses.MenuIterator;

// ITERATOR PART 2: THE CUSTOM COLLECTION THAT IMPLEMENTS ITERABLE OVER THE CUSTOM OBJECT
public class RestaurantMenu implements Iterable<MenuItem>
{
	List<MenuItem> menu = null;

	public RestaurantMenu()
	{
		menu = new ArrayList<MenuItem>();
		menu.add(new MenuItem("Idly", 4.00));
		menu.add(new MenuItem("Dosa", 6.50));
		menu.add(new MenuItem("Sambar Wada", 5.25));
		menu.add(new MenuItem("Uthappam", 8.49));
		menu.add(new MenuItem("Rava Dosa", 7.00));
	}

	public MenuIterator iterator()
	{
		return new MenuIterator(menu);
	}

}
